﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ProjectFitus.Models;

namespace ProjectFitus.Controllers
{
	[HandleError]
	public class QuestionController : Controller
    {
        IDBFitusRepository m_repo;
        //
        // GET: /Question/

        public QuestionController()
		{
			m_repo = new DBFitusRepository();
		}
        public QuestionController(IDBFitusRepository repo)
		{
			m_repo = repo;
		}

		protected override void OnException(ExceptionContext fc)
		{
			base.OnException(fc);
			FitusLogger.Instance.LogException(fc.Exception);

		}


        public ActionResult Index()
        {
            return View();
        }

        
        public ActionResult Details(int? id)
        {
            if(id.HasValue)
				return View();
			return View("Index");
        }

		[Authorize]
        public ActionResult Create()
        {   
            return View();
        } 

        [HttpPost]
		[Authorize]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        //
        // GET: /Question/Edit/5
 
        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /Question/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Question/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /Question/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
